package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Student;
import com.itheima.edu.info.manager.utils.AgeUtils;
import com.itheima.edu.info.manager.utils.InputUtils;

import java.util.Scanner;

public class StudentController extends BaseStudentController {
    Scanner sc = new Scanner(System.in);

    @Override
    public Student inputStudent(String id){
        System.out.println("请输入姓名:");
        String name = sc.next();
        System.out.println("请输入年龄:");
       /* String age = InputUtils.inputRule("\\d+岁");
        System.out.println("age = " + age);*/
        System.out.println("请输入出生日期:");
        String birthday = InputUtils.inputRule("\\d{4}-\\d{2}-\\d{2}");
        String age = AgeUtils.getAge(birthday);
        Student student = new Student(id,name,age,birthday);
        return student;
    }


}
